﻿@Cofe ?= {}

$ = jQuery
EventListener = Cofe.EventListener 
utils = Cofe.utils

class EventView extends EventListener 
  eventTemplate : $.templates("#eventTemplate")
  elements : 
    ".eventList" : "eleEventList"

  constructor : (constructionParam) ->    
    #console.log "EventView constructor"
    @bind("event", (sender, e) =>
      @eleEventList.append(e.render(@eventTemplate))
      path = e.data?.path
      parentPath = utils.extractFilepath(path)
      Cofe.Entry.invalidatePath(path)
      Cofe.Entry.invalidatePath(parentPath)
    )
    
    super

Cofe.EventView = EventView